<?php

namespace app\store\model\lucky;

use app\common\model\lucky\Goods as BaseGoods;
use think\db\exception\DbException;
use think\model\relation\BelongsTo;
use think\Paginator;

class Goods extends BaseGoods
{


    /**
     * @return \think\model\relation\HasMany
     */
    public function images(): \think\model\relation\HasMany
    {
        $model = "app\\common\\model\\UploadFile";
        return $this->hasMany($model, 'file_id', 'image_id');
    }

    /**
     * @param array $condition
     * @param string $field
     * @param array $with
     * @return Paginator
     * @throws DbException
     */
    public function getList(array $condition, string $field = '*', array $with = []): Paginator
    {
        return self::with($with)->where($condition)->field($field)->paginate();
    }
}